home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / dpkg / info / ecryptfs-utils.prerm < prev    next >
Encoding:
Text File  |  2009-06-04  |  1.1 KB  |  39 lines

  1. #!/bin/sh -e
  2.  
  3. if [ "$1" = remove ]; then
  4.     # We must do some checking to prevent removal of ecryptfs if in use
  5.     # Check active mounts
  6.     if out=`mount | grep "\Wtype\Wecryptfs\W"`; then
  7.         echo "ERROR: Cannot remove ecryptfs-utils, as it appears to be in use:" 1>&2
  8.         echo "$out" 1>&2
  9.         exit 1
  10.     fi
  11.     if out=`grep "\Wecryptfs\W" /proc/mounts`; then
  12.         echo "ERROR: Cannot remove ecryptfs-utils, as it appears to be in use:" 1>&2
  13.         echo "$out" 1>&2
  14.         exit 1
  15.     fi
  16.     # Check fstab
  17.     if out=`grep "\Wecryptfs\W" /etc/fstab`; then
  18.         echo "ERROR: Cannot remove ecryptfs-utils, as it appears to be in use:" 1>&2
  19.         echo "$out" 1>&2
  20.         exit 1
  21.     fi
  22.     # Check home directories
  23.     for i in `ls /home`; do
  24.         if [ -d "/home/$i/.ecryptfs" ]; then
  25.             # If we find a .ecryptfs directory (or link) in a home,
  26.             # directory, then someone is using ecryptfs-utils, and
  27.             # we should not allow package removal
  28.             echo "ERROR: Cannot remove ecryptfs-utils, as it appears to be in use:" 1>&2
  29.             echo "       [/home/$i/.ecryptfs]" 1>&2
  30.             exit 1
  31.         fi
  32.     done
  33.     pam-auth-update --package --remove ecryptfs-utils
  34. fi
  35.  
  36.  
  37.  
  38. exit 0
  39.